#!/usr/bin/perl -wT
use CGI qw(:standard);
use CGI::Carp qw(warningsToBrowser fatalsToBrowser);
use lib '.';
use users;
use strict;


my $cookie=cookie('cid');
my $username=read_cookie($cookie);

# get the cookie data

# set a new cookie that expires NOW
my $ncookie = cookie(-name=>'cid', -value=>$cookie, -expires=>'now');

# and delete the cookie from the user_cookies database too
delete_cookie($username,$cookie);

print header(-cookie=>$ncookie);
print start_html("Logged out");
print qq(<h2>Goodbye!</h2>\n);
print qq(You are now logged out.<br>\n);
print qq(<a href="login.cgi">Log back in</a><br>\n);
print end_html;
